﻿// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "Animation/AnimInstance.h"
#include "Character/BaseCharacter.h"
#include "CharacterAnimInstance.generated.h"

/**
 * 
 */
UCLASS()
class COMBAT_GAME_CPP_API UCharacterAnimInstance : public UAnimInstance
{
	GENERATED_BODY()

public:
	virtual void NativeInitializeAnimation() override;

	virtual void NativeUpdateAnimation(float DeltaSeconds) override;

	// 动画所属的pawn
	ABaseCharacter* Owner;

protected:
	//********************************************************* 动画的几个要素
	UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="AnimValue")
	float Speed_Anim;

	UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="AnimValue")
	float Direction_Anim;

	UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="AnimValue")
	bool Falling_Anim;

	UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="AnimValue")
	bool IsAttack_Anim;

	UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="AnimValue")
	bool IsDeath_Anim;


	//********************************************************* Player的动画通知
	// 装备武器时到手的通知
	UFUNCTION(BlueprintCallable)
	void AnimNotify_WeaponToHand(UAnimNotify* AnimNotify);

	// 装备武器时到手改变pose的通知
	UFUNCTION(BlueprintCallable)
	void AnimNotify_ChangeWeaponPose(UAnimNotify* AnimNotify);

	// 卸载武器时到手的通知
	UFUNCTION(BlueprintCallable)
	void AnimNotify_UnEquipToNormal(UAnimNotify* AnimNotify);

	// 卸载武器结束的通知
	UFUNCTION(BlueprintCallable)
	void AnimNotify_UnEquipEnd(UAnimNotify* AnimNotify);

	// 装备武器结束的通知
	UFUNCTION(BlueprintCallable)
	void AnimNotify_EquipEnd(UAnimNotify* AnimNotify);

	// 攻击结束的通知
	UFUNCTION(BlueprintCallable)
	void AnimNotify_AttackEnd(UAnimNotify* AnimNotify);

	//********************************************************* Enemy的动画通知
	// 敌人攻击结束的通知 // 被攻击时 攻击动画会被打断，此时要把行为树中判断正在攻击的状态结束掉
	UFUNCTION(BlueprintCallable)
	void AnimNotify_EnemyAttackEnd(UAnimNotify* AnimNotify);

	//********************************************************* BaseCharacter的动画通知
	UFUNCTION(BlueprintCallable)
	void AnimNotify_AttackDamage(UAnimNotify* AnimNotify);
};
